Skip to content

test: expand RhythmBlocks test suite coverage (#5607)#5772

Open
moksha-hub wants to merge 3 commits intosugarlabs:masterfrom
moksha-hub:expand-rhythm-blocks-tests-5607
Open

test: expand RhythmBlocks test suite coverage (#5607)#5772
moksha-hub wants to merge 3 commits intosugarlabs:masterfrom
moksha-hub:expand-rhythm-blocks-tests-5607

Conversation

@moksha-hub
Copy link
Contributor

Summary

This PR significantly expands the test suite for RhythmBlocks, addressing the test coverage expansion request in issue #5607.

Changes Made

Added 15+ new test cases in js/blocks/__tests__/RhythmBlocks.test.js covering:

Edge Cases

  • MyNoteValueBlock handles undefined connections gracefully
  • SkipNotesBlock handles zero and negative skip values
  • MultiplyBeatFactorBlock handles fractional factors (0.5)
  • RhythmicDotBlock and RhythmicDot2Block handle single and multiple dots

Block Validation

  • NewNoteBlock registration and argument count validation
  • NoteBlock macros (note1-note8) definitions verification
  • OctaveSpaceBlock and DefineFrequencyBlock existence checks
  • Rhythm blocks palette assignment verification

Flow Block Testing

  • Flow blocks return correct tuple format [result, isFlowComplete]
  • Validated across multiple block types (swing, newswing2, skipnotes, etc.)

Error Handling

  • Missing statusFields handling in status matrix mode
  • Missing singer object on turtle handling
  • Null blockList entries handling

Testing

All new tests pass successfully:

npm test -- js/blocks/__tests__/RhythmBlocks.test.js

Coverage Impact

  • Increased edge case coverage for RhythmBlocks
  • Added defensive programming tests for error conditions
  • Validated block registration and configuration

Related Issues

Fixes #5607

Checklist

  • Added comprehensive test cases
  • All tests pass locally
  • Follows existing test patterns
  • Covers edge cases and error conditions

@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

RhythmBlocks.test.js

@moksha-hub moksha-hub force-pushed the expand-rhythm-blocks-tests-5607 branch from 71b8967 to 5fe791d Compare February 17, 2026 14:45
@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

RhythmBlocks.test.js

@moksha-hub moksha-hub force-pushed the expand-rhythm-blocks-tests-5607 branch from 5fe791d to baafe3f Compare February 17, 2026 15:03
@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

RhythmBlocks.test.js

@vanshika2720
Copy link
Contributor

@moksha-hub Jest cases are failing.

@omsuneri
Copy link
Member

@moksha-hub please resolve the failing test cases !!

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

2 similar comments
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@moksha-hub
Copy link
Contributor Author

@vanshika2720 @omsuneri can you check now.
Thank you.

@omsuneri
Copy link
Member

@moksha-hub i m seeing some changes unrelated to this pr like the package.json is update please rebase your branch first before commiting !!

@moksha-hub moksha-hub force-pushed the expand-rhythm-blocks-tests-5607 branch from 3d36fda to 556e2b5 Compare February 20, 2026 08:02
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@moksha-hub moksha-hub force-pushed the expand-rhythm-blocks-tests-5607 branch from 556e2b5 to 5f9e138 Compare February 20, 2026 08:12
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@moksha-hub
Copy link
Contributor Author

@omsuneri Rebased onto the latest master now contains only the test file changes in a single clean commit. Package file changes have been removed.
@vanshika2720 Please have a review.
Thank you

Copy link
Contributor

@vanshika2720 vanshika2720 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moksha-hub a few tests use conditional checks like if (block) or if (result) which may allow silent passes.
It would be better to assert existence explicitly to prevent regressions.

@moksha-hub moksha-hub force-pushed the expand-rhythm-blocks-tests-5607 branch from 5f9e138 to 3d36fda Compare February 20, 2026 17:26
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

Added 15+ new test cases covering edge cases, block validation,
flow block behaviour, and error handling. All conditional guards
replaced with explicit expect() assertions per review feedback.

Fixes sugarlabs#5607
@moksha-hub moksha-hub force-pushed the expand-rhythm-blocks-tests-5607 branch from 3d36fda to 5391abf Compare February 20, 2026 17:31
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@moksha-hub
Copy link
Contributor Author

@vanshika2720 Replaced the conditional if (block) / if (result) guards with explicit expect().toBeDefined() assertions. Also corrected the flow-tuple test to only cover blocks that actually return tuples. All tests passing.

@moksha-hub
Copy link
Contributor Author

@vanshika2720 @omsuneri may i know place to discuss regarding any doubts on Gsoc 2026 as i am aiming for it.
opened 2prs, 1(merged).
Thanks for your time.

Copy link
Contributor

@vanshika2720 vanshika2720 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moksha-hub Thanks for the updates.

I still see conditional checks like if (block) and if (block && block.flow) in the tests. Please replace them with explicit assertions (expect(...).toBeDefined()) to avoid silent passes.

Also, for GSoC 2026 queries, please use the Sugar Labs GSoC Discussions:
https://github.com/sugarlabs/GSoC/discussions

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@moksha-hub
Copy link
Contributor Author

Thanks for your time.

@moksha-hub
Copy link
Contributor Author

@walterbender sir please have a review. And already it was reviewed by @vanshika2720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Chore] Music Blocks test suite project

3 participants